/**
 * Created by yhy on 17-3-11.
 */


'use strict'

//初始化页面之后的函数
$(function () {
    //参数校验部分
    $("#login-from").validate({
        errorElement: 'label',
        errorClass: 'input-error-display',
        rules: {
            username: {
                required: true,
                minlength: 4
            },
            password: {
                required: true,
                minlength: 6
            }
        },
        errorPlacement: function(error, element) {
            error.appendTo(element.parent());
        },
        highlight: function (element) {
            $(element).closest('.input-group').addClass('has-error');
        },
        success: function (label) {
            label.closest('.input-group').removeClass('has-error');
            label.remove();
        },

        submitHandler: function (form) {
            form.submit();
        }
    })


//背景图片
    $.backstretch([
        base_path+"/login/img/1.jpg",
        base_path+"/login/img/2.jpg",
        base_path+"/login/img/3.jpg",
        base_path+"/login/img/4.jpg"
    ], {
        fade: 1000,
        duration: 4000
    });
})


